package cn.zlp.hrm.task;

import cn.zlp.hrm.service.IKillCourseService;
import org.apache.commons.lang.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @program: hrm-parent
 * @author: Mr.Zhang
 * @create: 2022-01-20 19:29
 **/
@Component // 交给spring管理
public class PublishKillCourse2RedisTask {

    @Autowired
    private IKillCourseService killCourseService;
    @Scheduled(cron = "*/10 * * * * ?") //cron表达式
    public void publishKillCourse2RedisTask(){
        // System.out.println(DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
        killCourseService.publishKillCourse2Redis();
    }
}
